<?php
// +----------------------------------------------------------------------+
// | The Answern Inc                                                  |
// +----------------------------------------------------------------------+
// | Copyright (c) 2017, Answern Inc. All rights reserved.            |
// +----------------------------------------------------------------------+
// | Authors: Answern Inc. 
// |                                                                      |
// +----------------------------------------------------------------------+
 

namespace App\Controllers\Common;
use \App\Libs\Base\Constant;
use App\Models\Goods\Goods;
use \App\Models\User\User;

class GetUserInfo extends \App\Libs\Base\BaseAction
{
	 protected function beforeRun() {
         parent::beforeRun();
         $this->needLogin = TRUE;
     }
	public function execute() {
		$user = $this->session->user;
		$user = User::find(array(
			' id = :uid: ',
			'bind'=>array( 'uid'=>$user->id )
		));
		$data = array(
			'token' => $user->token,
			'name' => $user->username,
			'avatar' => $user->avatar,
			'baby_name' => $user->baby_name,
			'baby_sex' => $user->baby_sex,
			'baby_birthday' => $user->baby_birthday,
			'age' => \App\Libs\Helper\CommonHelper::age($user->baby_birthday),
			'vip' => $user->vip == 1?'已开通':'未开通',
			'balance' => $user->balance,
			'type' => 1,
			'phone' => $user->phone,
		 );
		 \App\Libs\Session\Session::resetCache($user);

		return \App\Libs\Views\Json::view(0, '手机号修改成功', $data);
		
		
		
	}
}
